package com.java.s1;
/**
 *
 * java 基础练习 星排序
 */
public class main {
    public static void main(String[] args) {
        printStar(9);
    }
    //打印星星图方法
    public static void printStar(int line){
        //正三角星号
        for (int i=0;i<line;i++) {
            for (int j = 0; j < line - i; j++) {
                System.out.print(" ");
            }
            for (int j = 0; j <= i; j++) {
                System.out.print("* ");
            }
            System.out.println();
        }
        //倒三角星号
        System.out.println("---------------------------");
        for (int x=0;x<line;x++) {
            for (int y = line; y > line - x; y--) {
                System.out.print(" ");
            }
            for (int y = line; y > x; y--) {
                System.out.print("* ");
            }
            System.out.println();
        }
    }
}
